 /**
 * Description: 盘点明细
 * @author:Hunter
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-04-08   Hunter       1.0.0     Initial
 */
package com.metro.paperless.app.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import com.metro.paperless.app.beans.vo.AppOutDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.paperless.app.mapper.IAppCheckDetailMapper;
import com.metro.paperless.app.service.inf.IAppCheckDetailService;
import com.metro.paperless.app.beans.vo.AppCheckDetail;

import java.util.List;

 /**
 * 盘点明细<br>
 *
 * @author:Hunter
 * @since:1.0.0
 * @version [1.0.0, 2018-04-08]
 */
@Service("appcheckdetailService")
public class AppCheckDetailService extends BaseServiceSupport<AppCheckDetail> implements IAppCheckDetailService{
    //盘点明细Mapper
    @Autowired
    private IAppCheckDetailMapper appcheckdetailMapper;

    @Override
    public IMapper getMapper() {
        return appcheckdetailMapper;
    }

    @Override
    public IResult save(AppCheckDetail entity) {
        try {
            appcheckdetailMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增盘点明细失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(AppCheckDetail entity) {
        try {
            appcheckdetailMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改盘点明细失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            appcheckdetailMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            appcheckdetailMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

     @Override
     public List<AppCheckDetail> queryListByCheckId(Long id) {
         List<AppCheckDetail> checkDetails = appcheckdetailMapper.queryListByCheckId(id);
         return checkDetails;
     }

 }